package com.ycb.controller;

import com.ycb.entity.Order;
import com.ycb.feign.OrderClient;
import com.ycb.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 黄泽群
 * @since 2023-12-11
 */
@RestController
@RequestMapping("/")
@RequiredArgsConstructor
public class OrderController implements OrderClient {

    private final OrderService orderService;


    @Override
    public List<Order> list(Integer id) {
        return orderService.lambdaQuery().eq(Order::getUserId,id).list();
    }

    @Override
    public Order create(Integer userId, Integer goodsId, Integer qty) {
        return orderService.create(userId,goodsId,qty);
    }
}
